//
//  CellForFocusNewsList.m
//  世界
//
//  Created by dllo on 16/3/2.
//  Copyright © 2016年 admin. All rights reserved.
//

#import "CellForFocusNewsList.h"
#import "ModelForFocusNews.h"
#import <UIImageView+WebCache.h>

@interface CellForFocusNewsList ()

@property (nonatomic, retain) UILabel *lableForNewsSummary;
@property (nonatomic, retain) UILabel *lableForTitle;
@property (nonatomic, retain) UIImageView *imgViewForPicUrl;

@end

@implementation CellForFocusNewsList


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self != nil)
    {
        self.lableForNewsSummary = [[UILabel alloc] init];
        
        [self.contentView addSubview:self.lableForNewsSummary];
        
        self.lableForNewsSummary.numberOfLines = 0;
        
        self.lableForTitle = [[UILabel alloc] init];
        
        self.lableForNewsSummary.textColor = [UIColor lightGrayColor];
        
        [self.contentView addSubview:self.lableForTitle];
        
        self.imgViewForPicUrl = [[UIImageView alloc] init];
        
        [self.contentView addSubview:self.imgViewForPicUrl];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.imgViewForPicUrl.frame = CGRectMake(5, 5, 90, 90);
    
    self.lableForNewsSummary.frame = CGRectMake(100, 30, self.contentView.frame.size.width - 100, 60);
    
    self.lableForTitle.frame = CGRectMake(100, 10, self.contentView.frame.size.width - 100, 20);
}


- (void)handleData:(ModelForFocusNews *)model
{
    self.lableForTitle.text = model.Title;
    
    self.lableForNewsSummary.text = model.NewsSummary;
    
    [self.imgViewForPicUrl sd_setImageWithURL:[NSURL URLWithString:model.PicUrl] placeholderImage:[UIImage imageNamed:@"占位图"]];
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
